<template>
  <div>
    <el-card>
      <p>物料信息编辑</p>
      <div style="margin:20px 0;">
        <el-collapse v-model="activeNames">
          <el-collapse-item title="基本信息" name="1">
            <el-form
              ref="baseInfoForm"
              :model="baseInfoForm"
              :inline="true"
              label-position="right"
              label-width='120px'
              style="width:100%"
            >
              <el-form-item label="AKS料号：" prop="aksMaterialNo" style="width:30%">
                <el-input v-model="baseInfoForm.aksMaterialNo" placeholder="请输入AKS料号"></el-input>
              </el-form-item>
              <el-form-item label="制造商料号：" prop="producerMaNo" style="width:30%">
                <el-input v-model="baseInfoForm.producerMaNo" placeholder="请输入制造商料号"></el-input>
              </el-form-item>
              <el-form-item label="制造商：" prop="producer" style="width:30%;margin-left:50px">
                <el-input v-model="baseInfoForm.producer" placeholder="请选择制造商"></el-input>
              </el-form-item>
              <el-form-item label="商品图：" prop="imgurl" style="width:100%">
                <el-upload
                  action="https://jsonplaceholder.typicode.com/posts/"
                  list-type="picture-card"
                  :on-preview="handlePictureCardPreview"
                  :on-remove="handleRemove"
                  :limit='15'
                >
                  <!-- <i class="el-icon-plus"></i> -->
                  <span>+添加图片</span>
                </el-upload>
                <span style="color:#aaa;font-size:14px">建议尺寸：800*800像素。最多上传15张</span>
                <el-dialog :visible.sync="dialogVisible" size="tiny">
                  <img width="100%" :src="dialogImageUrl" alt />
                </el-dialog>
              </el-form-item>
            </el-form>
          </el-collapse-item>
          <el-collapse-item title="物料描述" name="2">
            <el-form
              ref="descForm"
              :model="baseInfoForm"
              :inline="true"
              label-position="right"
              label-width='120px'
              style="width:100%"
            >
            
            </el-form>
          </el-collapse-item>
          <el-collapse-item title="价格库存" name="3"></el-collapse-item>
          <el-collapse-item title="文件上传" name="4"></el-collapse-item>
        </el-collapse>
      </div>
      <div style="width:100%;text-align:center;">
        <el-button type="primary">确认修改</el-button>
        <el-button type="info" style="margin-left:50px">取消修改</el-button>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeNames: ["1", "2", "3", "4"],
      baseInfoForm: {
        aksMaterialNo:'',
        producerMaNo:'',
        producer:'',
        imgurl:''
      },
      descForm:{
        
      },
      dialogImageUrl: "",
      dialogVisible: false
    };
  },
  methods: {
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    }
  }
};
</script>

<style lang="scss" scoped>
p {
  font-size: 20px;
  padding: 10px 0;
}
</style>